﻿using System;
using System.Collections.Generic;
using System.Linq;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using YArchitech.LIB;
using YArchitech.Revit;

namespace YArchitech.HVAC
{
	[Transaction(TransactionMode.Manual)]
	[Regeneration(RegenerationOption.Manual)]
	public class TestCommandDeleteMarks : HYExternalCommand
	{
		public override void FilterProcess()
		{
            base.FilterViewType.Add((ViewType)4);
			base.FilterProcess();
		}

		public override Result HYExecute(ref string tran)
		{
			ICollection<Element> collection = base.Sel.PickElementsByRectangle("请框选删除范围");
			if (collection == null)
			{
				return Autodesk.Revit.UI.Result.Failed;
			}
			if (collection.Count < 1)
			{
				return Autodesk.Revit.UI.Result.Failed;
			}
			ICollection<ElementId> collection2 = (from ele in collection
			select ele.Id).ToList<ElementId>();
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(base.Doc, collection2);
			filteredElementCollector.OfClass(typeof(Group));
			IDictionary<string, string> dictionary = new Dictionary<string, string>();
			dictionary.Add("typeName", "PipeLevel");
			dictionary.Add("tagsId", "000888");
			foreach (Element group in filteredElementCollector)
			{
				AssociationMarkInfo.WriteMarkInfoToElement(group, dictionary);
			}
			return Autodesk.Revit.UI.Result.Succeeded;
		}

		public static YJKWindowHandle hWndRevit;
	}
}
